1. Field of the Invention
The present invention relates to an image processing method and an image processing apparatus for use in an input and output apparatus for handling a variety of videos, such as a television set, a video cassette recorder, a still camera, a video camera, and a printer and, in particular, to an image processing method and an image processing apparatus for reproducing an input image into an image having a relatively narrow dynamic range on a video apparatus.
2. Description of the Related Art
A conventionally available method for converting the tonal gradation of pixels in an input image (hereinafter referred to “level conversion”) shifts a level of each pixel according to a function having an input and output relationship (hereinafter referred to as a “level conversion function”) represented by a solid line plotted in FIG. 10. Referring to FIG. 10, the abscissa represents the pixel level (input level) l of the input image, and the ordinate represents a pixel level (output level) T(l) of an output image as a result of a level conversion process. Lmax represents a maximum level taken by each pixel of the input and output images. Subsequent to the level conversion, the contrast of the image increases as the gradient of the level conversion function increases. With reference to FIG. 10, the gradients of straight lines above a threshold of an input level 1b and below a threshold of an input level 1s are smaller than the gradient of an intermediate-level straight line (between the input threshold levels 1s and 1b). The level conversion using the function illustrated in FIG. 10 increases the contrast of the intermediate level at the expense of the high-level and low-level ranges.
The level conversion function is not limited to the one shown in FIG. 10. For example, the level conversion function represented in a solid line plotted in FIG. 11 may be used. In the level conversion function plotted in FIG. 11, the gradient of a straight line on the high level region above an input threshold level lk is smaller than the gradient of a straight line in the intermediate- and the low-level regions below the input threshold level lk. In the level conversion function shown in FIG. 11, the contrast in the intermediate- and low-level regions is increased at the expense of the contrast in the high-level region. The gamma function expressed in equation (1) and the LOG function expressed in equation (2), more continuous than the functions illustrated in FIGS. 10 and 11, may also be used as a level conversion function. The letter g in equation (1) is a parameter adjusting the gradient of the function.                               T          ⁡                      (            l            )                          =                                            (                              l                                  L                  ⁢                                                                          ⁢                  max                                            )                        g                    ×          L          ⁢                                          ⁢          max                                    (        1        )                                          T          ⁡                      (            l            )                          =                                            log              ⁡                              (                l                )                                                    log              ⁡                              (                                  L                  ⁢                                                                          ⁢                  max                                )                                              ×          L          ⁢                                          ⁢          max                                    (        2        )            
Another conventional method adaptively changes a level conversion function depending on the frequency distribution of the pixel level in an input image. There is a method called histogram equalization representative of such methods. FIGS. 12A and 12B illustrate the principle of the histogram equalization. Referring to FIG. 12A, the abscissa represents the pixel level (input level) l of the input image, and the ordinate represents frequency (frequency of occurrences, or accumulated frequency of occurrences). Fmax represents the maximum value of the accumulated frequency of occurrences, and is thus a total number of pixels used to calculate the frequency of occurrences. In this method, the frequency distribution H(l) relating to the pixel level l in the input image is first generated as illustrated in FIG. 12A, and then the accumulated frequency distribution C(l) is generated using the following equation (3).                               C          ⁡                      (            l            )                          =                              ∑                          k              =              0                        I                    ⁢                      H            ⁡                          (              k              )                                                          (        3        )            
The level conversion function T(l) is generated by normalizing the ordinate of the accumulated frequency distribution C(l) within a level range that can be taken by an output image, using the following equation (4) (see FIG. 12B). Using the function T(l), the contrast of a region (having a large area) presenting high frequency of occurrences is increased.                               T          ⁡                      (            l            )                          =                                            C              ⁡                              (                l                )                                                    F              ⁢                                                          ⁢              max                                ×          L          ⁢                                          ⁢          max                                    (        4        )            
When an input image is used in a narrow dynamic range environment, namely, in an environment where a number of bits expressing pixel levels is small (for example, when the input image is transmitted over a transmission line having a smaller bit width, when the input image is displayed on a display using a small number of bits, or when the input image is stored in a storage device using a smaller number of bits), the dynamic range needs to be narrowed. To compress the dynamic range, the level conversion as discussed above is used. The maximum level of the image output in accordance with the level conversion function becomes smaller than that of the input image.
Another dynamic range compression method has been proposed in a paper entitled “A Multiscale Retinex for Color Rendition and Dynamic Range Compression in Applications of Digital Image Processing” authored by Z. Rahman, et. al., XIX Proc. SPIE 2847 (1996). According to this paper, an illumination light component that mildly changes in space is extracted using a low-pass filter, and is then compressed thereby to compress entire dynamic range (hereinafter this method is called “multiscale retinex”). A narrow-band linear low-pass filter is used to extract the illumination component. In accordance with this method, the dynamic range is compressed by subtracting the logarithm of a low-pass filter output LPF (I(x,y)) from the logarithm of the value I(x,y) of an input pixel.0(x, y)=log(I(x, y))−log(LPF(I(x, y)))  (5)
The above-referenced level conversion methods employ level conversion functions having a monotonously increasing property to avoid the generation of unnatural images. when the contrast in one level range (namely, the gradient of the level conversion function) is increased, the contrast in another level range is reduced.
The mutliscale retinex method allows an image of high contrast to be reproduced at the expense of the monotonously increasing property. However, when illumination conditions sharply change, the linear filter cannot extract such a change. Subjectively unwanted noise occurs.
For example, when linear low-pass filtering is performed on an image with two bordering regions having different illumination conditions (as represented by a solid line) in FIG. 13, a signal represented by a fine broken line and having a blurred border is obtained as a filter output. When the signal is treated as an illumination component, an illumination level is lower in a border area (a BNB area) than in an area (a BFB area) apart from the border in the left-hand side (a region B) of an illumination border. The aforementioned equation (5) is equivalent to a division operation in which an input signal is divided by an illumination component. The larger the illumination component, the more the dynamic range is compressed. As a result, an overshoot occurs in the BNB area in the reproduced image (as represented by a broken line). Conversely, the illumination level is regarded as higher in a border area (a DNB area) than in an area apart (a DFB area) from the border in the right-hand side (a region D) of the illumination border. Then, an undershoot occurs. In the mutliscale retinex method, a plurality of low-pass filters having different scales is used to avoid this problem. Results obtained from the low-pass filters are synthesized by using linear weights. The weights for the filters are fixed, and the aforementioned problem is not satisfactorily controlled.